﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using AjaxControlToolkit;
using System.Web.Services;
using System.Web.Script.Services;
namespace DasIdeen
{
    public partial class _Default : System.Web.UI.Page
    {
        [WebMethod]
        [ScriptMethod]
        public static Slide[] GetImages()
        {
            List<Slide> slides = new List<Slide>();
            string path = HttpContext.Current.Server.MapPath("~/ImageDisplaySlider/");
            if (path.EndsWith("\\"))
            {
                path = path.Remove(path.Length - 1);
            }
            Uri pathUri = new Uri(path, UriKind.Absolute);
            string[] files = Directory.GetFiles(path);
            foreach (string file in files)
            {
                Uri filePathUri = new Uri(file, UriKind.Absolute);
                slides.Add(new Slide
                {
                    Name = Path.GetFileNameWithoutExtension(file),
                    Description = Path.GetFileNameWithoutExtension(file) + " Description.",
                    ImagePath = pathUri.MakeRelativeUri(filePathUri).ToString()
                });
            }
            return slides.ToArray();
        }
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnTopics_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Pages/HowItWorks.aspx");
        }
        protected void btnAvailableResourecs_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Pages/ContentListing.aspx?ContentTypeCode=DNL");
        }
        protected void btnJoinOurCommunitty_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Pages/JoinOurCommunitty.aspx");
        }
    }
}
